#!/bin/bash

export JAVA_HOME=/gnplum/huanghefd/twotickets/jdk1.8.0_181;
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib;
export PATH=$JAVA_HOME/bin:$PATH;

java_pid=$(ps -ef | grep java | grep -E "ruoyi-admin" | awk '{print $2}')

if [ -z "$java_pid" ]; then
  echo "程序未在运行"
else
  echo "关闭正在执行的 java 进程: $java_pid"
  kill $java_pid
fi

echo "正在启动程序..."
#nohup java -Xms512m -Xmx2048m -jar /gnplum/huanghefd/twotickets/ruoyi-admin.jar  --server.port=18080 >>/gnplum/huanghefd/twotickets/logs/huanghefd.log 2>&1 &

nohup java -Xms512m -Xmx2048m -jar /gnplum/huanghefd/twotickets/ruoyi-admin.jar  --server.port=18080 > /dev/null 2>&1 &

if [ $? -eq 0 ]; then
  echo "启动成功！"
else
  echo "启动失败，请联系管理员！"
fi